package org.jc.oss.service;

import io.minio.*;
import io.minio.messages.Bucket;
import io.minio.messages.Item;
import org.jc.oss.entity.FileInfo;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 功能描述
 *
 * @author wanghongqian
 * @date 2024/07/04 15:42
 */
public interface StorageService {

    void createBucket(String bucket) throws Exception;

    /**
     * 上传文件
     */
    void uploadFile(MultipartFile multipartFile, String bucket, String objectName) throws Exception;

    /**
     * 列出所有桶
     */
    List<String> getAllBucket() throws Exception;

    /**
     * 列出所有桶及文件
     */
    List<FileInfo> getAllFile(String bucket) throws Exception;

    /**
     * 下载文件
     */
    InputStream download(String bucket,String objectName) throws Exception;

    /**
     * 删除桶
     */

    void deleteBucket(String bucket) throws Exception;
}
